package com.solace.disruptor;

public class SimplePriorities implements Runnable {
    private int countDown=5;
    private volatile double d;
    private  int proiority;

    public SimplePriorities(int proiority) {
        this.proiority = proiority;
    }
    public  String toString(){
        return Thread.currentThread() + ":" + countDown;
    }

    @Override
    public void run() {
        Thread.currentThread().setPriority(proiority);
        while (true){
            for (int i=1;i<10000;i++){
                d += (Math.PI + Math.E) / (double) i;
                if (i%1000==0)
                    Thread.yield();
                System.out.println(this);
                if (--countDown==0)
                    return;
            }
        }
    }
}
